package com.ruoyi.yuyuan.Controller;

import com.ruoyi.yuyuan.DTO.Result;
import com.ruoyi.yuyuan.Entity.Issue;
import com.ruoyi.yuyuan.Service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;
    @PostMapping("/login/wechat")
    public Result WXLogin(@RequestParam(value = "code", required = false) String code, @RequestParam String userName) {
        return userService.WXLogin(code,userName);
    }
    @PostMapping("/logout/wechat")
    public Result logOut(@RequestParam String authorization){
        return userService.logOut(authorization);
    }

    @GetMapping("/of/me")
    public Result getMe(){
        return userService.getMe();
    }

    @GetMapping("/of/{userId}")
    public Result getOther(@PathVariable Long userId){
        return userService.getOther(userId);
    }

    @PostMapping("/issue")
    public Result sendIssue(@RequestBody Issue issue){
        return userService.sendIssue(issue);
    }
}
